package cn.colins.consumer.filter;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.InvokerListener;
import org.apache.dubbo.rpc.RpcException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @program: dubbo-annotation-study
 * @description:
 * @author: colins
 * @create: 2023-05-07 22:09
 **/
//@Activate(group = {CommonConstants.CONSUMER,CommonConstants.PROVIDER})
public class MyListener implements InvokerListener {
    private final static Logger log= LoggerFactory.getLogger(MyListener.class);

    @Override
    public void referred(Invoker<?> invoker) throws RpcException {
        log.info("当有服务引用时被调用: {}",invoker.getUrl());
    }

    @Override
    public void destroyed(Invoker<?> invoker) {
        log.info("当服务引用被销毁时被调用: {}",invoker.getUrl());
    }
}
